package com.bjsxt.car.controller;

import java.util.Date;

import javax.annotation.Resource;

import org.junit.Test;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.alibaba.fastjson.JSONObject;
import com.bjsxt.car.common.util.ConstantFinalUtil;
import com.bjsxt.car.common.util.DateUtil;
import com.bjsxt.car.users.pojo.CClient;
import com.bjsxt.car.users.service.IUserService;



/**
 * 管理员的 controller
 * @author XuGuoQing07
 *
 */
@Controller
public class AdminsHeadController
{
	@Resource
	private DateUtil dateUtil;
	@Resource
	private IUserService usersService;
	
	/*---- 管理员操作模块开始 ----*/
	@RequestMapping("/adminsInsert")
	public String adminsInsert()
	{
		ConstantFinalUtil.LOGGER.info("====adminsInsert====");
		return "/index-2";
		
	}
	
	
	@RequestMapping("/adminsInsertSubmit")
	public String clientInsertSubmit()
	{
		ConstantFinalUtil.LOGGER.info("--adminsInsert--");
		/* 为在jsp上面木有赋值的属性后台赋值 */
		CClient client = new CClient();
		client.setName("haha");
		client.setGender(0);
		client.setPhone("1234");
		client.setPassword("7777");
		client.setProfession("学生");
		client.setIdcard("9876");
		client.setAddress("上海");
		JSONObject resultJSON = this.usersService.saveOneClientService(client);
		String info = resultJSON.get("info") + "";
		System.out.println("=========" + info);
		/* 存储的结果给放到Request中 */
		//model.addAttribute("info", info);
		//return "/index-2";
		return null;
		
	}
	/*---- 管理员操作模块结束 ----*/
}
